<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${base}/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="${base}/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/js/messages_zh.js"></script>
<script type="text/javascript" src="${base}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${base}/js/jquery.ztree.all-3.4.min.js"></script>
<link rel="stylesheet" href="${base}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript">
	function cycleDay(){
		window.location.href="${base}/add.nutz";
	}
	var setting = {
			check: {
				enable: true
			},
			data: {
				simpleData: {
					enable: false
				}
			},
			callback:{
				onCheck:onCheck
			}
		};
		$(document).ready(function(){
			$.getJSON("${base}/remTask/findMember.nutz", function(zNodes){
				$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			});
		});

		  function onCheck(e,treeId,treeNode){
				var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
				nodes = zTree.getCheckedNodes(true),
				v = "";
				for (var i=0, l=nodes.length; i<l; i++) {
					//只记录叶子节点权限ID.
					if(!nodes[i].isParent){
						if(v!=""){
							v += "," + nodes[i].value;
						}
						else{
							v += nodes[i].value;
						}
					}
				}
				//设置权限ID值。
				$("#taskMemberStr").val(v);
			}
		    
		function check(){
			if(document.getElementById("taskname").value==''||document.getElementById("taskname").value.length>50){
	    		alert("未输入标题或标题过长!");
	    		document.getElementById("taskname").focus();
	    		return false;
	    	}
	    	if(document.getElementById("remcontent").value==''){
	    		alert("请输入备注!");
	    		document.getElementById("remcontent").focus();
	    		return false;
	    	}
	    	if(document.getElementById("rem_first_time").value==''){
	    		alert("请选择提醒时间!");
	    		document.getElementById("rem_first_time").focus();
	    		return false;
	    		}
	    	if(document.getElementById("taskMemberStr").value==''){
	    		alert("请选择组员!");
	    		document.getElementById("taskMemberStr").focus();
	    		return false;
	    		}
	    	else{
	    		return true;
	    	}	
	    }
</script>
<title>content</title>
</head>
<body>
<form action="${base}/remTask/save.nutz" method="post" >
<input type="hidden" name="taskMemberStr" id="taskMemberStr"/>
<table width="80%" align="left" >
   <tr>
        <td><input name="rem_type" type="radio" value="0" checked onClick=""/>单次提醒 </td>
        <td><input name="rem_type" type="radio" value="1"  onClick="cycleDay();"/>周期提醒</td>
   </tr>
   <tr>
 		<td>标题:</td>
 		<td><input name="task_name" id="taskname" size="100" value=""/></td>
 	</tr>

 	 <tr>
 		<td>备注</td>
 		<td><textarea name="rem_content" id="remcontent"  rows="5" cols="75"/></textarea></td>
 	</tr>
 	 <tr>
 		<td>提醒时间</td>
 		<td><input name="rem_first_time" id='rem_first_time' value="" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/></td>
 	</tr>
 	<tr>
 		<td><input type="checkBox" name="rem_way" value="0" checked onClick=""/>邮件</td>
    	<td><input type="checkBox" name="rem_way" value="1" />短信</td>
    </tr>
    <tr>
    	<td>提醒是否有效:</td>
 		<td>
 			<input type="radio" name="rem_status" value="1" checked onClick=""/>有效
 			<input type="radio" name="rem_status" value="0" />无效
 		</td>
    </tr>
	<tr>
		<td>
		请选择择通知人员：
		</td>
	</tr>
   
    <tr>
    	<td colspan="2">
    		<ul id="treeDemo" class="ztree"></ul>
		</td>
     </tr>
     <tr>
    	<td align="center" colspan="2">
    		<input type="submit" name="queding" value="确定" onClick="return check();"/>
    		<input type="reset" name="quxiao" value="取消" />
    	</td>
    </tr>
 </table>
 </form>
</body>
</html>